package zb.blog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zb.blog.base.bean.Result;
import zb.blog.service.ILoginService;

import javax.servlet.http.HttpSession;
import java.util.Map;

@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private ILoginService iLoginService;

    /**
     * @Author: BinZhang
     * @Date: 2018/5/12 9:33
     * @Description:跳转后台管理到主页
     */
    @RequestMapping("")
    @ResponseBody
    public Result login(@RequestBody Map<String, String> param, HttpSession session) {
        return iLoginService.login(param, session);
    }

    @RequestMapping("/back/exit")
    @ResponseBody
    public Boolean exit() {
        return iLoginService.exit();
    }

    /**
     * @Author: BinZhang
     * @Date: 2018/5/19 18:37
     * @Description:检测是否已经登录
     */
    @RequestMapping("/checkLogined")
    @ResponseBody
    public boolean checkLogined() {
        return iLoginService.checkLogined();
    }
}
